package com.lzj.server;

import jakarta.annotation.Resource;
import org.mybatis.spring.annotation.MapperScan;
import org.redisson.api.RedissonClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
@MapperScan("com.lzj.server.repository.mapper")
public class VideoApplication implements CommandLineRunner {
    @Resource
    private RedissonClient redissonClient;


    public static void main(String[] args) {
        SpringApplication.run(VideoApplication.class, args);
    }

    /**
     * SpringBoot启动后执行该方法 因为布隆过滤器需要在RedissonClient实例化后才能使用
     */
    @Override
    public void run(String... args) throws Exception {
        // 构建布隆过滤器 key
/*        String key = RedisConstant.ALBUM_BLOOM_FILTER;
        RBloomFilter<Long> bloomFilter = redissonClient.getBloomFilter(key);
        bloomFilter.tryInit(1000000, 0.03);*/
    }
}
